1. Field of the Invention
This apparatus and method relates to providing an interface to a compound Universal Serial Bus controller and, in particular, to providing synchronization between a hardware interface module and the controlling software.
2. Description of the Related Art
Universal Serial Bus (USB) is a standard peripheral interface for attaching personal computers to a wide variety of devices: e.g., digital telephone lines, monitors, modems, mice, printers, scanners, game controllers, keyboards, and other peripherals. A USB thus replaces existing interfaces such as the RS-232C serial ports, parallel ports, PS/2 interface and game/MIDI ports.
In accordance with USB, all attached devices connect to a personal computer through a single connector type using a tiered-star topology. A host personal computer includes a single USB controller. The host controller provides the interface between the USB network and the host personal computer. The host controller controls all accesses to USB resources and monitors the bus's topology. A USB hub provides USB attachment points for USB devices.
The USB hubs and devices may be connected and disconnected without completely re-starting the USB network. Upon connection of a device or hub to an upstream hub the upstream hub will notify the host controller of a change in status. Following USB protocol, the host controller will enable the port of the hub to which the device is connected. The host controller will then assign a unique functional address to each device. Ports are enabled one at a time as the host controller 102 assigns unique furnctional addresses. Upon connection of a compound device, the host controller assigns a unique functional address to each device contained within the compound device.
A USB Function is a portion of a USB device that is able to transmit and receive information on the bus. A Function may have one, or more, configurations, each of which is made up of one of more endpoints.
An endpoint is the ultimate source, or sink, of data. An endpoint pipe provides for the movement of data between the USB and memory, and completes the path between the USB Host and the function endpoint. Up to 16 such endpoints are supported at any given time, for each functional address.
At initialization of an endpoint device, the host controller associates a pipe with the endpoint functions. The pipes allow the host controller to move data into and out of a host memory buffer to and from the endpoints. The USB implements two types of pipe communication modes: stream and message. Stream data does not have a defined USB structure. Message data does have a defined USB structure.
After the initialization process completes, endpoint pipes can be allocated to particular endpoints. Accordingly, devices which include a plurality of endpoint functions will be assigned a plurality of pipes (each associated with a particular endpoint).
Each endpoint is an addressable entity on USB and is required to respond to tokens from the USB host controller.
Although a device may include a plurality of endpoint functions, those endpoint functions may not necessarily operate simultaneously. By way of example, a multi-function device may include a fax and a digital telephone function. During initialization, the multi- function device is assigned a unique functional address and the fax and digital telephone functions are each associated with distinct endpoint numbers. Out pipes for transmitting data to each function are likewise allocated during initialization. One out pipe is associated with an endpoint number for the fax function, and one out pipe is associated with an endpoint number for the printer function. A fax and digital telephone will each typically require an isochronous out pipe because their transactions should operate in real time.
The operation of a USB device typically involves an interface module, which connects to a USB network. The interface module includes a programming interface, which is accessible for operation of an endpoint function. The endpoint function passes data to an endpoint pipe so that it can be transmitted over a USB network. Likewise, the endpoint function receives data from an endpoint pipe for use by the function.
To perform such operations over a USB network the function must carefully coordinate the actions of the interface module. For example, the function must insure that bulk transfers are completed without error. This requires providing and accepting the appropriate handshakes with a host controller. The time a function spends on processing such handshakes limits its ability to perform other operations. Moreover, on a noisy USB network much of the data transmitted may be corrupted. This places additional burdens on the function, which must provide appropriate responses to corrupted data.
Accordingly a USB interface module is desired which provides an efficient programming interface to a function and which places a minimal processing burden on the function for responding to typical USB network conditions.